

<div class="box">
    <?php if(!$this->cart->contents()):
    echo 'You don\'t have any items yet.';
else:
?>
 
<?php echo form_open('book/updateCart'); ?>
<div class="col-lg-12">


<table class="table  tbl_text">
    <thead>
        <tr>
            <th>Couverture</th> <!-- Image -->
            <th>Titre</th> <!-- Book Name -->
            <th>Prix</th> <!-- <th>Price</th>   -->
            <th>Quantité</th> <!-- Qty -->
            <th>sous-total</th> <!-- Sub-Total -->
            <th>Option</th>
        </tr>
    </thead>
    <tbody>
        <?php 

        $i = 1; 
        $total = 0;

        ?>
        <?php foreach($this->cart->contents() as $items): ?>
         
        <?php 

      
        echo form_hidden('rowid[]', $items['rowid']);
           $shipping = $items['shipping']*$items['qty'];
           $subTotal = $this->cart->format_number($items['subtotal']);
          
         ?>
        <tr <?php if($i&1){ echo 'class="alt"'; }?>>
             
            <td>
                 <img src="<?php echo base_url().'public/img/books/'.$items['img']; ?>" class="img-responsive imgCardView" alt="" />
            </td>
             
            <td><?php echo $items['name']; ?></td>
             
            <td><?php echo $this->cart->format_number($items['price']) . ' € TTC' ; ?></td>
             <td>
                <?php echo form_input(array('name' => 'qty[]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '3','class'=>'inputCart')); ?>
            </td>
            <td><?php echo $subTotal . ' € TTC'; ?></td>
            <td>
              
                <button value="<?php echo $items['rowid']?>" class="btn btn-xs btn-danger removeCard"><span class="glyphicon glyphicon-trash"></span></button>
            </td> 
        </tr>
        <?php $i++; ?>
        <?php endforeach; ?>
         
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td><strong>Total :</strong></td>
            <td><span class="totalText"><?php echo $this->cart->format_number($this->cart->total()) . ' € TTC'; ?></span></td>
            <td></td>
        </tr>
    </tbody>
</table>
 
    </div>
    <div class="col-lg-5">
        <p><small class="textRed">* Si la quantité est egale à zero, le produit sera enleve du panier.</small></p> <!-- If the quantity is set to zero, the item will be removed from the cart -->
    </div>
    <div class="col-lg-7">
        <p class="pull-right">
            <?php 
                echo form_submit('save', 'modifier le panier','class="btn btn-primary no_radus"').'&nbsp;&nbsp;';  
               
            ?>
            <?php 

            if($this->session->userdata("loggedIn")):
                 echo anchor('book/orderCard', 'Acheter', 'class="btn btn-primary no_radus"').'&nbsp;';
            else:
             ?>
           <!--  <a class="btn btn-primary no_radus" data-backdrop="static" data-toggle="modal" data-target="#orderCard">Buy From Saller</a> -->
            
            <?php 
                echo anchor('book/signIn', 'Acheter', 'class="btn btn-primary no_radus"').'&nbsp;';
                endif;

             ?>

        </p>
    </div>
    <?php 
echo form_close(); 
endif;
?>
</div>
<!-- <div class="modal fade" id="orderCard" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content" id="modal_content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">Sign in</h4>
            </div> 
            <?php echo form_open('book/login','class="formLogin"'); ?>
            <div class="modal-body">
                <div class="form-group">
                    <input type="text" name="email" class="form-control no_radus" id="uLogin" placeholder="Email" />
                    <span class="idEmail"></span>
                </div> 
                <div class="form-group">
                    <input type="password" id="passCard" name="password" class="form-control no_radus" id="uPassword" placeholder="Password" />
                    <span class="idPass"></span>
                </div> 
                <div class="checkbox">
                    <label>
                        <input name="remember" value="1" type="checkbox" /> Remember me
                    </label>
                </div>
                <a>Forget Password? </a><a href="<?php echo base_url(); ?>index.php/book/register"><span class="pull-right">Join Free</span></a>
            </div> 
            <div class="modal-footer">
                <input type="submit" class="form-control btn btn-primary" value="Ok"/>
                
            </div> 
            </form>
        </div>
    </div>
</div> -->